<script>
export default {

    data() {
        return {
            user: JSON.parse(sessionStorage.getItem("user")),
        }
    },

    methods: {
        addBalance(balance) {
            this.$axios.post(this.$httpUrl + '/user/addbalance', {

                "uid": this.user.id,
                "balance": balance
            }).then(res => res.data).then(res => {
                if (res.code === 200) {
                    this.$notify({
                        title: '成功',
                        message: '增加成功，当前余额为:' + Number(res.data.balance).toFixed(4),
                        type: 'success'
                    });
                    sessionStorage.setItem('user', JSON.stringify(res.data))
                }
            })
        },
    }
}
</script>

<template>
<div>
    <el-ro>
        <el-col>
            <el-button type="primary" @click="addBalance(1000)">+1000元，这不比卷计算机赚钱容易？</el-button>
        </el-col>
    </el-ro>
</div>


</template>

<style scoped>

</style>